****** Do File for all Tables in Court Performance and Citizen Attitudes Towards Fighting Corruption*****
**********************************************************************************************************

use corruption_repl, clear



label var working "courts working" 
label var convict "convictions" 
label var trust_courts "trust courts"
label var support_sp "support corruption spending"
label var oppose "paying bribes not okay"
label var efficacy "citizen efficacy about corruption"
label var impartial "impartiality treatment" 
label var efficiency "efficiency treatment"
label var high_ranking "grand corruption treatment" 
label var jobs_sal "jobs salient"
label var cor_sal "corruption salient" 
label var trust_pol "trust politicians"  
label var female "female" 
label var age "age"
label var empl_secure "employed"
gen low_ranking =high_ranking==0
label var low_ranking "petty corruption"
gen interact1=impartial*low_ranking
label var interact1 "impartial*low_ranking"
gen interact2=impartial*high_ranking
label var interact2 "impartial*high_ranking"
labe var pol_prom "politicians keep promises"
label var education "education level"



*1 Signals
eststo clear
 foreach var of varlist convictions {
xi: regress `var'  efficienc impartial jobs cor_sal trust_pol female age empl_secure party_id gov_party opp_party i.country i.cluster 
eststo `var'1
}



xi: logit working  efficienc  impartial jobs cor_sal trust_pol female age empl_secure gov_party opp_party i.country i.cluster
eststo working1: margins, dydx(efficienc  impartial) atmeans post


esttab working1 convictions1 using "C:\Users\Eva\Dropbox\research\papers\under_review\r&r\corruption\revision\figs_maintext\signals.rtf", replace se label nogaps ///
title({\b Table 3.} {\b Efficiency and Impartiality as Credible Signals}) ///
mtitles ("courts working" "convictions") ///
keep(impartial efficiency ) ///
starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) 

* note for all tables: Controls: country, stratum, age, gender, employment, unemployment salience, corruption salience, trust in politicians)


*2 Citizen Channel
 foreach var of varlist efficacy oppose_bribes {
xi: regress `var' efficienc impartial jobs cor_sal trust_pol female age empl_secure gov_party opp_party  i.country i.cluster 
eststo `var'1
}


foreach var of varlist efficacy oppose_bribes {
xi: regress `var' efficienc impartial low_ranking interact1 jobs cor_sal trust_pol female age empl_secure gov_party opp_party i.country i.cluster 
eststo `var'2
}



esttab efficacy1 oppose_bribes1 efficacy2 oppose_bribes2 using "C:\Users\Eva\Dropbox\research\papers\under_review\r&r\corruption\revision\figs_maintext\citizenresp.rtf", replace se label nogaps ///
title({\b Table 4.} {\b Citizen Channel}) ///
keep(efficiency impartial low_ranking interact1) ///
starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) ///
coeflabels(interact1 "impart*petty" low_ranking "petty corrupt.") ///
b(%9.3f)
* note for all tables: Controls: country, stratum, age, gender, employment, unemployment salience, corruption salience, trust in politicians)



*3 Institutional Channel
 foreach var of varlist trust_courts support_spend {
xi: regress `var' efficienc impartial jobs cor_sal trust_pol female age empl_secure gov_party opp_party i.country i.cluster  
eststo `var'1
}


 foreach var of varlist trust_courts support_spend {
xi: regress `var' efficienc impartial high_ranking interact2 jobs cor_sal trust_pol female age empl_secure gov_party opp_party i.country i.cluster  
eststo `var'2
}

esttab trust_courts1 support_spend1 trust_courts2 support_spend2 using "C:\Users\Eva\Dropbox\research\papers\under_review\r&r\corruption\revision\figs_maintext\institutional.rtf", replace se label nogaps ///
title({\b Table 5.} {\b Institutional Channel}) ///
keep(efficiency impartial high_ranking interact2) ///
starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) ///
coeflabels(interact2 "impart*grand" high_ranking "grand corrupt.") ///
b(%9.3f)

* note for all tables: Controls: country, stratum, age, gender, employment, unemployment salience, corruption salience, trust in politicians)


*3b: Trust
xi: logit working efficie impartial jobs cor_sal trust_pol female age empl_secure i.country i.cluster if  pol_prom>2
eststo working1: margins, dydx(efficie impartial) atmeans post 
esttab working1, se 

 foreach var of varlist convict  support_spend {
xi: regress `var' efficie impartial jobs cor_sal trust_pol female age empl_secure gov_party opp_party i.country i.cluster if  pol_prom>2
eststo `var'1
}


 foreach var of varlist  support_spend {
xi: regress `var' efficienc impartial high_ranking interact2 trust_pol female age empl_secure gov_party opp_party i.country i.cluster if  pol_prom>2
eststo `var'3
}

esttab working1 convictions1  support_spend1 support_spend3 ///
using "C:\Users\Eva\Dropbox\research\papers\under_review\r&r\corruption\revision\figs_maintext\institutional_trust.rtf", replace se label nogaps ///
title({\b Table 6.} {\b Trust in Politics and Institutional Channel}) ///
keep(efficiency impartial high_ranking interact2) ///
starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) ///
coeflabels(interact2 "impart*grand" high_ranking "grand corrupt.") ///
b(%9.3f)
